//
//  JJStatusViewModel.swift
//  JJSina
//
//  Created by mac on 2017/12/7.
//  Copyright © 2017年 xinyuan. All rights reserved.
//

import UIKit

class JJStatusViewModel: NSObject {
    var homeModel: JJHomeModel? {
        didSet {
            VIPImage = dealVIPImage(mbrank: homeModel?.user?.mbrank ?? 0)
            avatarImage = dealAvatarImage(verified: homeModel?.user?.verified ?? 0)
        }
    }
    
    var VIPImage: UIImage?
    var avatarImage: UIImage?
}
// MARK: -处理业务逻辑
extension JJStatusViewModel {
    // 用户会员等级
    func dealVIPImage(mbrank: Int)-> UIImage? {
        if mbrank >= 1 && mbrank <= 6 {
            return UIImage(named: "common_icon_membership_level\(mbrank)")
        } else {
            return UIImage(named: "common_icon_membership")
        }
    }
    // 用户类型认证
    func dealAvatarImage(verified: Int)-> UIImage? {
        switch verified {
        case 1:
            return UIImage(named: "avatar_vip")
        case 2,3,5:
            return UIImage(named: "avatar_enterprise_vip")
        case 220:
            return UIImage(named: "avatar_grassroot")
        default:
            return UIImage(named: "")
        }
    }
}


